//JavaScript Framework 2.0 Code
try{
Type.registerNamespace('com.yonyou.ncmm_pac_pda.SimpleDemoWindowController');
com.yonyou.ncmm_pac_pda.SimpleDemoWindowController = function() {
    com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.initializeBase(this);
    this.initialize();
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$initialize(){
    //you can programing by $ctx API
    //get the context data through $ctx.get()
    //set the context data through $ctx.push(json)
    //set the field of the context through $ctx.put(fieldName, fieldValue)
    //get the parameter of the context through $ctx.param(parameterName)
    //Demo Code:
    //    var str = $ctx.getString();      //获取当前Context对应的字符串
    //    alert($ctx.getString())          //alert当前Context对应的字符串
    //    var json = $ctx.getJSONObject(); //获取当前Context，返回值为json
    //    json["x"] = "a";        //为当前json增加字段
    //    json["y"] = [];           //为当前json增加数组
    //    $ctx.push(json);            //设置context，并自动调用数据绑定
    //    
    //    put方法需手动调用databind()
    //    var x = $ctx.get("x");    //获取x字段值
    //    $ctx.put("x", "b");     //设置x字段值
    //    $ctx.put("x", "b");     //设置x字段值
    //    $ctx.databind();            //调用数据绑定才能将修改的字段绑定到控件上
    //    var p1 = $param.getString("p1");   //获取参数p2的值，返回一个字符串
    //    var p2 = $param.getJSONObject("p2");   //获取参数p3的值，返回一个JSON对象
    //    var p3 = $param.getJSONArray("p3");   //获取参数p1的值，返回一个数组
    
    //your initialize code below...
    
}
    
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$evaljs(js){
    eval(js)
}
com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.currentQueryCondition=null;
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$viewPage0_onload(sender, args){
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_openquery_onclick(sender, args){
	$id("slidingviewdefine0").set("openleftview","true");
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_add_onclick(sender, args){
	$id("slidingviewdefine0").set("openrightview","true");
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_query_onclick(sender, args){
	$ctx.dataCollect();
	com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.currentQueryCondition={
		"orderid_fulllike":$ctx.getString("qrytxt_orderid"),
		"material":$ctx.getString("qrytxt_material"),
		"orderdate_dateweekin":$ctx.getString("qrytxt_orderdate"),
		"ordermaker":$ctx.getString("qrytxt_ordermaker")
	};
	NCMMPubUtil.queryVOByConditions(OrderVO,com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.currentQueryCondition,function(data){
		var json={listdata:data};
		$ctx.push(json);
	});
	$id("slidingviewdefine0").set("openleftview","false");
	NCMMPubUtil.notifyFilter("txt_quickfilter","listviewdefine0",["orderid"]);
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_submit_onclick(sender, args){
	$ctx.dataCollect();
	var order={
		"orderid":$ctx.getString("txt_orderid"),
		"material":$ctx.getString("txt_material"),
		"orderdate":$ctx.getString("txt_orderdate"),
		"ordermaker":$ctx.getString("txt_ordermaker")
	};
	if($id("orderid").get("disabled")=="true"||$id("orderid").get("disabled")=="disabled"){
		NCMMPubUtil.updateVO(OrderVO,order);
		$id("orderid").set("disabled","false");
	}else{
		NCMMPubUtil.insertVO(OrderVO,order);
	}
	$id("slidingviewdefine0").set("openrightview","false");
	NCMMPubUtil.queryVOByConditions(OrderVO,com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.currentQueryCondition,function(data){
		var json={listdata:data};
		$ctx.push(json);
	});
	NCMMPubUtil.notifyFilter("txt_quickfilter","listviewdefine0",["orderid"]);
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$slidingviewdefine0_onload(sender, args){
	$id("slidingviewdefine0").set("openleftview","false");
	$id("slidingviewdefine0").set("openrightview","false");
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_createtbl_onclick(sender, args){
	NCMMPubUtil.createTable(OrderVO);
	$alert("建表完成");
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_scancode_onclick(sender, args){
}
function scanreturn(){
	$id("slidingviewdefine0").set("openrightview","true");
	var code = $param.getString("code");
	$ctx.put("txt_orderid",code);
	$ctx.dataBind();
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_openscan_onclick(sender, args){
	$view.open({
    	"viewid" : "com.yonyou.ncmm_pac_pda.TwoDCodeScanWindow",
    	"isKeep" : "true",
       	"callback" : "scanreturn()"
    });
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$panel_main_onload(sender, args){
	
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$listview_onitemclick(sender, args){
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_remove_onclick(sender, args){
	NCMMPubUtil.queryVOCount(OrderVO,null,function(count){
		$alert("count:"+count);
	});
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$panel4_ondoubletap(sender, args){
	var row=$id("listviewdefine0").get("row");
	row=$stringToJSON(row);
	$id("slidingviewdefine0").set("openrightview","true");
	$ctx.put("txt_orderid",row["orderid"]);
	$ctx.put("txt_material",row["material"]);
	$ctx.put("txt_orderdate",row["orderdate"]);
	$ctx.put("txt_ordermaker",row["ordermaker"]);
	$ctx.dataBind();
	$id("orderid").set("disabled","disabled");
}
function com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$panel4_onlongclick(sender, args){
	var row=$id("listviewdefine0").get("row");
	row=$stringToJSON(row);
	if($confirm("是否删除订单："+row["orderid"])){
		NCMMPubUtil.deleteVO(OrderVO,row);
		NCMMPubUtil.queryVOByConditions(OrderVO,com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.currentQueryCondition,function(data){
			var json={listdata:data};
			$ctx.push(json);
		});
	}
}
com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.prototype = {
    panel4_onlongclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$panel4_onlongclick,
    panel4_ondoubletap : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$panel4_ondoubletap,
    btn_remove_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_remove_onclick,
    listview_onitemclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$listview_onitemclick,
    panel_main_onload : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$panel_main_onload,
    btn_openscan_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_openscan_onclick,
    btn_scancode_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_scancode_onclick,
    btn_createtbl_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_createtbl_onclick,
    slidingviewdefine0_onload : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$slidingviewdefine0_onload,
    btn_submit_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_submit_onclick,
    btn_query_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_query_onclick,
    btn_add_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_add_onclick,
    btn_openquery_onclick : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$btn_openquery_onclick,
    viewPage0_onload : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$viewPage0_onload,
    initialize : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$initialize,
    evaljs : com$yonyou$ncmm_pac_pda$SimpleDemoWindowController$evaljs
};
com.yonyou.ncmm_pac_pda.SimpleDemoWindowController.registerClass('com.yonyou.ncmm_pac_pda.SimpleDemoWindowController',UMP.UI.Mvc.Controller);
}catch(e){$e(e);}
